package com.youlai.quarkus.system.controller;

import com.youlai.quarkus.system.common.result.Result;
import com.youlai.quarkus.system.model.dto.FileInfo;
import com.youlai.quarkus.system.model.dto.UploadFile;
import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.core.MediaType;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.eclipse.microprofile.openapi.annotations.Operation;
import org.eclipse.microprofile.openapi.annotations.tags.Tag;
import org.jboss.resteasy.annotations.providers.multipart.MultipartForm;

@Tag(name = "07.文件接口")
@Path("/api/v1/files")
@RequiredArgsConstructor
@Slf4j
public class FileController {

    /*
         https://quarkus.io/guides/resteasy-client-multipart
        要处理以multipart/form-data作为内容类型的HTTP请求，您可以使用常规的@RestForm注释
     */
    @POST
    @Operation(summary = "文件上传")
    @Path("uploadFile")
    @Consumes(MediaType.MULTIPART_FORM_DATA)
    public Result<FileInfo> uploadFile(
            @MultipartForm UploadFile file
    ) {
        return Result.success();
    }

}
